* Plural matchRuleTest
*/
function matchRuleTest(cRule, val){
- js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
+ //js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
function checkValue(compare, val){
if(typeof compare == 'string'){
for(var ruleInx in rs){
cRule = rs[ruleInx];
if( matchRuleTest( cRule, tObj.arg ) ){
- js_log("matched rule: " + ruleInx );
+ //js_log("matched rule: " + ruleInx );
return getTempParamFromRuleInx(tObj, rCount );
}
rCount ++;
}
- js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] );
+ //js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] );
//return the last /"other" template param
return tObj.param [ tObj.param.length -1 ];
}
// ... but I am having fun with recursion so here it is...
// or at least mirror: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
- function rdpp ( txt , cn){
+ function rdpp ( txt , cn){
var node = {};
//inspect each char
for(var a=0; a < txt.length; a++){
node['c'] = new Array();
node['c'].push( rdpp( txt.substr( a ), true ) );
- }else if( txt[a] == '}' && txt[a+1] == '}'){
+ }else if( txt[a] == '}' && txt[a+1] == '}'){
+ a=a+2;
if( !node['p'] ){
return node;
- }
- node = node['p'];
- a=a+2;
+ }
+ node = node['p'];
}
if(!node['t'])
node['t']='';
-
- if( txt[a] )
- node['t']+=txt[a];
+ //dont put closures into output:
+ if( txt[a] && txt[a]!='}' )
+ node['t'] += txt[a];
}
return node;
tObj["arg"] = tname.split(':').pop();
}
- js_log("TNAME::" + tObj["name"] + ' from:: ' + ts);
+ //js_log("TNAME::" + tObj["name"] + ' from:: ' + ts);
var pSet = ts.split('\|');
pSet.splice(0,1);
if( pSet.length ){
<script type="text/javascript" >
var scriptLoaderURID = 't11';
//for just setting one or two to test at a time for debug
-var langKeyDebug = ['fr'];
+var langKeyDebug = [ 'az', 'da', 'pt', 'fr', 'lv',c 'en'];
//shortLangKey is an array of at least one language from every group in cldrConverter.php
var langKeyGroups = ['en','az', 'da', 'pt', 'fr', 'lv', 'ga','hr','cy','mk','mt','pl','sl'];
js2AddOnloadHook( function(){
//do mauall script loaders calls to test multiple languages:
- function doLangTable(langSet){
+ function doLangTable( langSet ){
//build table output:
var msgTestSet = {
'undelete_short': [ 0, 1, 2, 5, 21, 30 ],
var passTest=0;
var failTest=0;
var testCount=0;
- $j.each(langSet, function(na, langKey){
- js_log('load language key: ' + langKey);
- //do a manual call to the script-lodaer:
- js_log('do load: ' + '../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey );
- $j.getScript('../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){
+
+
+ //do a manual call to the script-lodaer:
+ function doProcLangKey(langKey){
+ $j.getScript('../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){
var o='';
o+='<tr><td colspan="6" height="20" style="font-size:large"><b>Lang:' + langKey + '</b></td></tr>';
//now for each langage msg:
do_api_req({
'data': {
'action' : 'parse',
- 'uselang' : 'fr',
+ 'uselang' : langKey,
'text' : '{{int:' + mKey + '|' + msgparam + '}}'
},
'url' : '../../../api.php'
var failHtlm = (failTest == 0)?failTest: '<span style="color:red">'+ failTest+'</span>';
$j('#score_card').html(
'Passed: <span style="color:green">' + passTest + '</span> Failed:' + failHtlm );
+
+ //done with this lang... call outer function if we have lang keys left to proccess:
+ if(langSet.length!=0)
+ doProcLangKey( langSet.pop() );
}
}else{
$t.html(' error ');
o+='<tr><td colspan="6" height="20"> </td></tr>';
});
//put the output into the page:
- $j('#table_out').append( o );
- });
- });// each lang key
+ $j('#table_out').append( o );
+ });
+ }//procc lang key:
+ doProcLangKey( langSet.pop() );
}
//by default run the "debug" set:
doLangTable( langKeyDebug );